<?php
	require '../../include/library.inc.php';
	require '../../include/admin_login.inc.php';
	
	$image_id =$_REQUEST["file"];
	$id =$_REQUEST["db"];
	$dr = $_REQUEST["dir"];
	$cx = $_REQUEST["cx"];
	if($image_id) {
	
	$sql = "DELETE FROM 
			   catalog_image
			WHERE
			   image_id = $id
			 ";
	query($sql);
	
	
	unlink($dr.$image_id);
	unlink($dr.'th_'.$image_id);
	
	$_SESSION['message'] = 'Снимката е премахната!';
	}
    //redirect($_SERVER['HTTP_REFERER']);

	redirect( 'catalog_edit.php?catalog_id='.$cx);
?>